package com.ssyt.hiring.common;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ssyt.hiring.talent.entity.TalentEntity;

public class App {

	public static int getTalentId(HttpServletRequest request,
			HttpServletResponse response) {
		try {
			Object obj = request.getSession().getAttribute("talent");
			if (obj == null) {
				request.setAttribute("msg", "长时间没有操作，请重新登录！");
				request.getRequestDispatcher("/WEB-INF/view/talent/login.jsp")
						.forward(request, response);
			} else {
				TalentEntity talent = (TalentEntity) obj;
				int talentId = talent.getId();
				return talentId;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		throw new RuntimeException("未知错误，获取求职者id失败！");
	}
}
